-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
child_process: fix IPC 'message' event regression #13856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also keep the benchmark in?
lib/internal/child_process.js
Outdated
} | ||
process.nextTick(() => { | ||
target.emit(eventName, message, handle); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the use of the emit()
function to avoid allocating this closure?
@mcollina updated to only remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but it might be nice to point out how much throughput we lose with this fix, with a comparative benchmark of the one the original commit introduced.
Benchmark results from my machine:
Looks like only a fraction of the gains from #13459 were lost. |
Thanks Colin. Still LGTM. |
Confirm test fails on my machine as well (Windows). |
This commit fixes a regression related to IPC 'message' events. When messages are not emitted in the next tick, a 'message' handler that throws can break the IPC read loop. Refs: nodejs#6909 Refs: nodejs#13459 Refs: nodejs#13648 PR-URL: nodejs#13856 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
The benchmark results from the original PR would be these since the PR was originally started before the V8 5.9 merge, so this revert has a larger impact actually. Probably the only thing that makes it have a little less of an impact is the |
This commit fixes a regression related to IPC 'message' events. When messages are not emitted in the next tick, a 'message' handler that throws can break the IPC read loop. Refs: #6909 Refs: #13459 Refs: #13648 PR-URL: #13856 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
This commit fixes a regression related to IPC 'message' events. When messages are not emitted in the next tick, a 'message' handler that throws can break the IPC read loop. Refs: #6909 Refs: #13459 Refs: #13648 PR-URL: #13856 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
This commit fixes a regression related to IPC 'message' events. When messages are not emitted in the next tick, a 'message' handler that throws can break the IPC read loop. Refs: #6909 Refs: #13459 Refs: #13648 PR-URL: #13856 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
I've thrown a baking label on this... we should likely land if we backport other change |
This PR reverts 8208fda from #13459. When IPC messages are not emitted in the next tick, a
'message'
handler that throws can break the IPC read loop. This was originally fixed in #6909.The second commit in this PR adds a regression test that fails with 8208fda, but passes with the revert (at least on my machine).
Note: I believe this can be fixed without a full revert of 8208fda, but wanted to use that as a starting point for this PR.
Refs: #6909
Refs: #13459
Refs: #13648
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
child_process, test